# $Id: GNUmakefile,v 1.6 2005/05/09 13:44:58 gcosmo Exp $
# ----------------------------------------------------------------
# GNUmakefile for geometry/CSG library.  Gabriele Cosmo, 16/11/96.
# ----------------------------------------------------------------

CXX =g++
LD  =g++

SourceSuf =cpp
ObjectSuf =o              
SharedSuf =so

SourceDir =./src
TmpDir       =./tmp
BinDir       =./bin
LibDir       =./lib

Target =SCTest
TargetBin = $(Target)
TargetObj = $(Target).$(ObjectSuf)
TargetSrc = $(Target).$(SourceSuf)
TargetSo =lib$(Target).$(SharedSuf)

Source    =$(wildcard $(SourceDir)/*.$(SourceSuf))
Object    =$(patsubst %.$(SourceSuf),%.$(ObjectSuf),$(Source))
Include    =-I./include/
CXXFLAGS += -g -fPIC 

LDFLAGS +=  -lCLHEP
LDFLAGS +=  -lgsl
LDFLAGS +=  -lgslcblas

.PHONY: all   
all:  $(TargetBin)  $(TargetSo)

	-@mkdir -p tmp
	-@mkdir -p bin
	-@mkdir -p lib
	-@mv $(TargetBin) $(BinDir) 
	-@mv $(TargetSo) $(LibDir) 
	-@mv $(Object) $(TmpDir) 
	-@mv $(TargetObj) $(TmpDir) 

$(TargetBin): $(Object)  $(TargetObj)
	 $(LD) $^ -o $@  $(LDFLAGS) 

$(TargetSo): $(Object)
	 $(LD) -shared $(LDFLAGS) $^ -o $@

$(TargetObj): $(TargetSrc)
	 $(CXX) -c $< -o $@  $(CXXFLAGS) $(CPPFLAGS) $(Include) 

$(Object): %.$(ObjectSuf) : %.$(SourceSuf)
	 $(CXX) -c $< -o $@  $(CXXFLAGS) $(CPPFLAGS) $(Include) 
